import {Component, OnInit, Output, EventEmitter, Input} from '@angular/core';
import {Menu} from '../../../../entity/menu.model';

@Component({
  selector: 'app-star',
  templateUrl: './star.component.html',
  styleUrls: ['./star.component.css']
})
export class StarComponent implements OnInit {

  @Input() menu: Menu;

  /**
   * 风场集合组件
   *
   *
   * @memberof FarmSelectorComponent
   */
  @Output() checked: EventEmitter<Menu> = new EventEmitter<Menu>();

  constructor() {
  }

  ngOnInit() {
  }

  /**
   * 是否显示五角星
   *
   * @memberof MenuComponent
   */
  public onShowStar(event: any) {
    window.event ? window.event.cancelBubble = true : event.stopPropagation();
    this.menu.isFavorite = !this.menu.isFavorite
    this.checked.emit(this.menu);
  }
}
